package cn.edu.jsu.official.config;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Mo
 * @createTime 2022/3/31 19:56
 * @descripiton
 */
@Getter
public enum FileTypeEnum {
    JPEG("jpeg", "FFD8FF"),
    JPG("jpg", "FFD8FF"),
    PNG("png", "89504E47"),
    BMP("bmp", "424D"),
    RTF("rtf", "7B5C727466"),
    DOC("doc", "D0CF11E0"),
    DOCX("docx", "504B030414"),
    PDF("pdf", "255044462D312E");
    private String fileSuffix;
    private String fileHeadMessage;

    FileTypeEnum(String fileSuffix, String fileHeadMessage) {
        this.fileSuffix = fileSuffix;
        this.fileHeadMessage = fileHeadMessage;
    }

    public static List<String> getFileTypeList() {
        FileTypeEnum[] fileTypes = FileTypeEnum.values();
        List<String> fileTypeList = Arrays.stream(fileTypes)
                .map(FileTypeEnum::getFileSuffix).collect(Collectors.toList());
        return fileTypeList;
    }
}
